(when (not (= (vector-length command-line-arguments) 1))
   (display "Usage: monos -f discard.scm generator-file\n")
   (exit))

(let* ((file (vector-ref command-line-arguments 0))
       (input (open-input-file file))
       (components (eval (read input)))
       (ones
          (list->monomial 
             (make-list 
                (dimension (lex-order-ref components)) 1)))  
       (size (java.util.List:size components)) )
    (write
       (do ((i 0 (if (monomial-divides?
                        (lcm (java.util.List:get components i))
                        ones)
                     (begin (invoke 'remove components i) i)
                     (+ i 1)) ))
           ((= i size) components) ) ) )
                  

